#pragma once
#include <string>
#include <vector>
#include <fstream>
#include <iostream>

#include <windows.h>


using std::string;
using std::vector;
using std::cout;
using std::endl;

using uchar = unsigned char;

struct Node {
	string name;
	bool rotate;
	int x, y, w, h, ow, oh, ox, oy, index;
	// offest/spriteOffest  spriteSize
	int sx, sy, sw, sh;
};




namespace {
	void trim(const string& ori, string& str) {
		str.clear();
		for (const auto& c : ori) {
			if (c != ' ') {
				str.push_back(c);
			}
		}
	}

	void split(const string& ori, const string& delim, vector<string>& ret) {
		ret.clear();
		size_t last = 0;
		string str;
		trim(ori, str);
		size_t index = str.find_first_of(delim, last);

		if (index == string::npos) {
			ret.push_back(str);
			return;
		}

		while (index != string::npos) {
			ret.push_back(str.substr(last, index - last));
			last = index + 1;
			index = str.find_first_of(delim, last);
		}

		if (index - last > 0) {
			ret.push_back(str.substr(last, index - last));
		}
	}
}
